AS=/usr/local/mips-cross/bin/mipsel-elf-as
CC=/usr/local/mips-cross/bin/mipsel-elf-gcc
LD=/usr/local/mips-cross/bin/mipsel-elf-ld
OBJCOPY=/usr/local/mips-cross/bin/mipsel-elf-objcopy
OBJDUMP=/usr/local/mips-cross/bin/mipsel-elf-objdump

all:
	$(AS) -mips1 branchy.S -o branchy.o -EL 
	$(LD) -mips1 -T ../../lib/default.ld branchy.o -o branchy.elf -EL
	$(OBJCOPY) -j .startup.bootvec -j .startup -O binary branchy.elf branchy.bin
	hexdump -e "1/4 \"%08x\n\"" branchy.bin -v > branchy.hex
	cat ../../lib/nops.hex >> branchy.hex
	
dump:
	$(OBJDUMP) -j .startup.bootvec -j .startup -D branchy.elf

symbols:
	$(OBJDUMP) -t branchy.elf

sections:
	$(OBJDUMP) -h branchy.elf

clean:
	rm -f branchy.bin branchy.elf branchy.hex branchy.o
